<?php
require_once 'PHPUnit/Framework.php';
$dbms = "mysql";
$pathAdjust = "../../../scripts/";
if((@include_once "{$pathAdjust}initIncludePaths.inc") == "1")
    echo "included from $pathAdjust\r\n";
else {
    $pathAdjust = "../../scripts/";
    if((@include_once "{$pathAdjust}initIncludePaths.inc") == "1")
        echo "included from $pathAdjust\r\n";
    else {
        $pathAdjust = "../scripts/";
        if((@include_once "{$pathAdjust}initIncludePaths.inc") == "1")
            echo "included from $pathAdjust\r\n";
        else {
            $pathAdjust = "scripts/";
            if((@include_once "{$pathAdjust}initIncludePaths.inc") == "1")
                echo "included from $pathAdjust\r\n";
            else {
                $pathAdjust = "./";
                if((@include_once "{$pathAdjust}initIncludePaths.inc") == "1")
                    echo "included from $pathAdjust\r\n";
            }
        }
    }
}
include_once "dbFac.inc";

class DatabaseFactoryTest extends PHPUnit_Framework_TestCase {
    public function testGetSettingsLoc() {
        $dbf = new DatabaseFactory();
        $setPath = $dbf->getSettingsLoc();
        $this->assertEquals('C:\wamp\www\2dbv2\scripts\dba\settings.inc', $setPath);
    }
    public function testReadSettings() {
        $dbf = new DatabaseFactory();
        $res = $dbf->readSettings();
        $this->assertEquals('2db', $dbf->getDbName());
        $this->assertEquals('mysql', $dbf->getDbms());
        $this->assertEquals('localhost', $dbf->getHost());
        $this->assertEquals('', $dbf->getPass());
        $this->assertEquals('root', $dbf->getUser());
    }
    public function testDetermineAvailableDBMS() {
        $dbf = new DatabaseFactory();
        $res = $dbf->determineAvailableDBMS();
        $this->assertEquals("mysql",$res[0]);
    }
    public function testConnect() {
        $dbf = new DatabaseFactory();
        $db = $dbf->connect();
        $this->assertEquals(true,$db->isConnected());
    }
}
?>